#include "WPILib.h"

#ifndef SMART_JOYPAD_H
#define SMART_JOYPAD_H

class SmartJoypad
{
	static const int NUM_BUTTONS = 12;
	static const int NUM_AXES = 6;

	bool buttons[NUM_AXES];
	float axes[NUM_BUTTONS];
	
	Joystick* joystick;
	
public:
	
	// Named conversions from button numbers 
	// for the Logitech Dual-Action Controller.
	enum JoypadButton {
		FACE_W = 1, 
		FACE_S = 2, 
		FACE_E = 3, 
		FACE_N = 4, 
		BUMPER_L1 = 5, 
		BUMPER_R1 = 6, 
		BUMPER_L2 = 7, 
		BUMPER_R2 = 8, 
		AUX_L = 9, 
		AUX_R = 10,
		LEFT_STICK = 11, 
		RIGHT_STICK = 12
	};
	
	// Named conversions from numbers 
	// for the Logitech Dual-Action Controller.
	enum JoypadAxis {
		STICK_LX = 1, 
		STICK_LY = 2, 
		STICK_RX = 3, 
		STICK_RY = 4, 
		DPAD_X = 5, 
		DPAD_Y = 6 
	};
	
	SmartJoypad(UINT32 port);
	~SmartJoypad();
	
	bool GetButton(JoypadButton button);
	bool GetButtonPress(JoypadButton button);
	bool GetButtonRelease(JoypadButton button);
	
	float GetAxis(SmartJoypad::JoypadAxis axis);
	float GetAxisDelta(SmartJoypad::JoypadAxis axis);
	
	// Save the current state of the joypad, so it can be compared to later.
	void Remember();
};

#endif
